import type { BaiduElements } from '../../../../../../../../types/constants'
import { ThemeVarService } from '../../../../../../../../lib/abstract/style/theme_var/service'
import { PageHandler } from '../../../../../../../../lib/page_handler'
import {
  BAIDU_RESULT_BASE_SELECTOR,
  BaiduPageType,
} from '../../../../../../../../lib/page_handler/platform/baidu/types'
import {
  AppStyleCollections,
  PAGE_ELEMENTS,
  SUPPORTED_PLATFORMS,
} from '../../../../../../../../types/constants'
import { StylesService } from '../../../../../../../../types/constants/styles'
import { ThemeType } from '../../../../../../../../types/interfaces'
import { SearchCommonStyles } from '../../common'
import { BaiduCommonPage } from './common'

const BASE_STYLES = `
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
`

enum AI_ANSWER_TPL {
  AI_INDEX = 'ai_index',
  NEW_BAI_KAN_INDEX = 'new_baikan_index',
  WENDA_GENERATE = 'wenda_generate',
  AI_ASK = 'ai_ask',
}

const AI_ANSWER_CONFIG: Record<AI_ANSWER_TPL, {
  children: boolean
  container?: string
}> = {
  // 搜索关键词：MAC Big Sur搭建hadoop+spark环境
  [AI_ANSWER_TPL.AI_INDEX]: {
    children: true,
  },
  // 搜索关键词：重庆高校排名
  [AI_ANSWER_TPL.NEW_BAI_KAN_INDEX]: {
    children: true,
  },
  // 搜索关键词：bootstrap5
  [AI_ANSWER_TPL.WENDA_GENERATE]: {
    children: false,
    container: '.c-group-wrapper',
  },
  // 搜索关键词：bootstrap5
  [AI_ANSWER_TPL.AI_ASK]: {
    children: false,
    container: '.c-group-wrapper',
  },
}

export class BaiduWebPage {
  elements: BaiduElements = PAGE_ELEMENTS[SUPPORTED_PLATFORMS.BAI_DU]
  private static instance: BaiduWebPage
  private readonly themeVarService: ThemeVarService = ThemeVarService.getInstance()
  private readonly stylesService: StylesService = StylesService.getInstance()
  private readonly searchCommonStyles: SearchCommonStyles = SearchCommonStyles.getInstance()
  private readonly commonPage: BaiduCommonPage = BaiduCommonPage.getInstance()
  private readonly pageHandler: PageHandler = PageHandler.getInstance()

  private readonly pageType = this.pageHandler.pages.baidu.pageType
  private readonly maskId: string = '_mask'
  readonly containerSelector: string = '#content_left'
  private readonly resultSelector: string = BAIDU_RESULT_BASE_SELECTOR

  /**
   * 获取单例实例
   */
  public static getInstance(): BaiduWebPage {
    if (!BaiduWebPage.instance) {
      BaiduWebPage.instance = new BaiduWebPage()
    }
    return BaiduWebPage.instance
  }

  init(): void {
  }

  /**
   * 获取全宽网格列样式
   */
  get fullGridColumnStyles(): string {
    return `
grid-column: 1 / -1;
grid-row: auto;
margin-left: 15px !important;
`
  }

  /**
   * 获取全宽网格列选择器组
   */
  getFullGridColumnSelectors(): string {
    return [
      `> div:not(${this.resultSelector})`,
    ].join(', ')
  }

  /**
   * 获取全宽网格列子元素选择器组
   */
  getFullGridColumnTplChildrenSelectors(): string {
    return [
      ...Object.values(AI_ANSWER_TPL),
    ].map(tpl => `&[tpl="${tpl}"]`).join(', ')
  }

  /**
   * 获取全宽网格列子元素样式
   */
  FullGridColumnChildrenStyles(): string {
    return `
${this.getFullGridColumnSelectors()} {
  ${this.fullGridColumnStyles}
  > span {
    color: var(${this.themeVarService.search.default.text}) !important;
  }
}

${this.resultSelector} {
  ${this.getFullGridColumnTplChildrenSelectors()} {
    ${this.fullGridColumnStyles}
  }
}
`
  }

  /**
   * 获取所有子元素选择器组
   */
  getChildrenSelectors(): string {
    return Object.entries(AI_ANSWER_CONFIG)
      .map(([tpl, _]) => `&[tpl="${tpl}"]`)
      .join(', ')
  }

  /**
   * 获取直接子元素选择器组
   */
  getDirectChildrenSelectors(): string {
    return Object.entries(AI_ANSWER_CONFIG)
      .filter(([_, cfg]) => cfg.children)
      .map(([tpl, _]) => `&[tpl="${tpl}"]`)
      .join(', ')
  }

  /**
   * 获取后代元素选择器组
   */
  getDescendantSelectors(): string {
    return Object.entries(AI_ANSWER_CONFIG)
      .filter(([_, cfg]) => !cfg.children)
      .map(([tpl, _]) => `&[tpl="${tpl}"]`)
      .join(', ')
  }

  /**
   * 获取 AI 回答样式
   */
  aiAnswerBaseStyles(): string {
    const supportPages = [
      BaiduPageType.Web,
    ]

    // 动态生成容器选择器组（去重）
    const containerSelectors = [...new Set(
      Object.values(AI_ANSWER_CONFIG)
        .filter(cfg => !cfg.children && cfg.container)
        .map(cfg => `> ${cfg.container}`),
    )].join(', ')

    // 构建样式字符串
    return !supportPages.includes(this.pageType as BaiduPageType)
      ? ''
      : `
    /* 直接子元素样式 */
    > ${this.resultSelector} {
      ${this.getDirectChildrenSelectors()} {
        width: calc(100% - 3 * 15px) !important;
      }
    }

    /* 后代容器样式 */
    ${containerSelectors} {
      width: calc(100% - 15px) !important;
      margin: 0 auto 15px;
      margin-left: 15px !important;
      background: var(${this.themeVarService.search.resultItem.background}) !important;

      ${this.resultSelector} {
        margin-left: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
          
        ${this.getDescendantSelectors()} {
          margin: 0 !important;
          width: calc(100% - 2 * 15px) !important
        }
        
        &:not(:last-child) {
          padding-bottom: 0 !important;
        }
      }

      &::after {
        border: none !important;
      }
    }
  `
  }

  aiAnswerSpecialStyles(): string {
    const supportPages = [
      BaiduPageType.Web,
    ]

    return !supportPages.includes(this.pageType as BaiduPageType)
      ? ''
      : `
/* AI 回答 */
> ${this.resultSelector} {
  ${this.getDirectChildrenSelectors()} {
    [class^="_content-border"] {
      [class^="_bg-header"] {
        display: none !important;
      }
      
      [class^="_content"] {
        [class^="top-btn"] {
          ${this.commonPage.stopButtonIconStyles()}
        }

        [data-module="char"][class^="title"] {
          color: var(${this.themeVarService.search.default.textPrimary}) !important;
        }
        
        [class^="markdown-wrapper"] {          
          /* 展开 */
          [data-module="more"] {
            background: var(${this.themeVarService.answer.switch.mask.background}) !important;

            [class^="fold"] {
              background-image: none !important;
            }
          }
        }
        
        /* 建议 */
        [data-module="suggestion"] {
          [class*="_sc-divider-horizontal"] {
            &::after {
              background-color: transparent !important;
            }
          }
        }
      }
    }
  }
}
`
  }

  aiAnswerStyles(theme: ThemeType): string {
    const supportPages = [
      BaiduPageType.Web,
    ]

    return !supportPages.includes(this.pageType as BaiduPageType)
      ? ''
      : `
/* AI 回答 */
${this.getChildrenSelectors()} {
  ${this.commonPage.foldSwitchStyles()}
  
  /* 代码块 */
  pre {
    .dqa-code-pre {
      .dqa-code-block {
        border: none !important;
      }
    }
  }
  
  .c-group-wrapper {
    ${BASE_STYLES}
    flex-direction: column !important;

    &::after {
      border: none !important;
    }
    
    /* 折叠开关 */
    [class^="cosd-fold-switch-mask"] {
      background: var(${this.themeVarService.search.resultItem.background}) !important;
    }
  }
  
  .cosc-card-content-border {
    .cosc-card-light-bg {
      height: auto !important;
    }
    
    .cosc-card-content {
      /* 停止按钮 */
      [data-module="stopButton"] {
        ${this.commonPage.stopButtonIconStyles()}
      }

      /* 听图标 */
      .sc-audio-pause, .sc-audio-play {
        [class^="img-light"] {
          display: ${theme === ThemeType.DARK ? 'none' : 'inline'} !important;
        }
        [class^="img-dark"] {
          display: ${theme === ThemeType.DARK ? 'inline' : 'none'} !important;
        }
      }
      
      /* 加载图标 */
      .cosd-markdown-loading {
        background: var(${this.themeVarService.answer.loading.background}) !important;
      }
      
      /* 搜索步骤 */
      .cosd-searching-steps {
        .cosd-searching-step-content {
          color: var(${this.themeVarService.search.default.text}) !important;
        }
      }
      
      /* 展开遮罩 */
      [class^="cosd-fold-switch-mask"] {
        background: var(${this.themeVarService.answer.switch.mask.background}) !important;
      }
    }
  }
  
  [class^="accordion-panels-title"] {
    color: var(${this.themeVarService.search.default.text}) !important;
  }
  
  .cos-divider {
    background-color: transparent !important;
  }
  
  /* logo */
  [class*="nbk-brand-logo-image"] {
    width: 64px !important;
  
    &[class*="img-light"] {
      display: ${theme === ThemeType.DARK ? 'none' : 'inline'} !important;
    }
    
    &[class*="img-dark"] {
      display: ${theme === ThemeType.DARK ? 'inline' : 'none'} !important;
    }
  }
  
  /* AI 反馈结果 */
  .cosd-markdown {
    
    /* 遮罩 */
    .cosd-markdown-mask {
      background: transparent !important;
    }

    .marklang {
      color: var(${this.themeVarService.search.default.text}) !important;

      h3 {
        color: var(${this.themeVarService.search.default.textPrimary}) !important;
      }
      
      p, .marklang-paragraph, ol li, ul li, mark {
        color: var(${this.themeVarService.search.default.text}) !important;
      }
      
      ol li strong {
        background: linear-gradient(to right, var(${this.themeVarService.answer.default.background}), var(${this.themeVarService.answer.default.background})) no-repeat center bottom !important;
        background-size: 100% 9px !important;
      }
    }
  }
  
  /* 分割线 */
  [class*="dqa-aiAsk-wrap"] {
    [class*="divider-dqa"] {
      &::after {
        background-color: transparent !important;
      }
    }
  }
}
`
  }

  // 测试关键词：
  // 1）.c-group-wrapper 去掉边框：邓紫棋
  getMainStyles(theme: ThemeType): string {
    return `
  /* 主样式 */
  #wrapper_wrapper {
    margin: 0 auto !important;
  }    
  
  /* 搜索标签 */   
  #searchTag {
    ${BASE_STYLES}
    background: transparent !important;
    padding-bottom: 20px;
    
    &.tag-fixed {
      background: var(${this.themeVarService.search.header.background}) !important;
      box-shadow: none !important;
      padding-top: 20px !important;
    }
    
    > div {
      margin: 0 !important;
      width: fit-content !important;
    }
  }
  
  #wrapper_wrapper {
    background: transparent !important;

    /* 搜索结果*/
    #container {
      width: fit-content !important;
      padding: 0 !important;
      padding-right: var(--scrollbar-offset) !important;
      color: var(${this.themeVarService.search.default.text}) !important;
      
      /* 平台样式类 */
      [class^="under-line"], .cos-line-clamp-1, [class^="pc-detail-info"] > span  {
        color: var(${this.themeVarService.search.default.text}) !important;
      }
      .cos-link-button > .cos-line-clamp-1 {
        color: var(--cos-color-text-link) !important;
      }
      
      /* 礼 */
      [class*="gift-tag"] {
        padding-right: 10px !important;
      }
      [class*="gift-color"] {
        color: var(${this.themeVarService.search.default.text}) !important;
      }
      
      .new-pmd .c-color-t {
        color: var(${this.themeVarService.search.default.textPrimary}) !important;
      }

      ${this.containerSelector} {
        ${this.searchCommonStyles.resultContainerStyles({ setGap: false })}
        position: relative;
        ${this.FullGridColumnChildrenStyles()}
        
        /* 无搜索结果 */
        #noresult {
          margin-left: 0 !important;
          
          .c-abstract {
            color: var(${this.themeVarService.search.default.text}) !important;
          }
        }
        
        /* 资源类空白块 */
        .ecom_pingzhuan.old-pmd {
          display: none !important;
        }
        
        /* 搜索提示 */
        .hit-toptip {
          ${BASE_STYLES}
        }
        
        ${this.aiAnswerBaseStyles()}
        ${this.aiAnswerSpecialStyles()}
        
        .cu-border {
          &::after {
            border: none !important;
          }
        }
        
        /* 搜索智能聚合 */
        .search-source-wrap {
          display: none !important;
        }
        
        /* 搜索结果 */
        ${this.resultSelector} {
          ${this.searchCommonStyles.resultItemStyles()}
          color: var(${this.themeVarService.search.default.text}) !important;
          margin: 0 auto ${this.themeVarService.search.resultItem.gap} 0;
          margin-left: 15px !important;
          
          ${this.aiAnswerStyles(theme)}
          
          /* 边框 */
          .c-border {
            &::after {
              border: none !important;
            }
          }
          
          .c-gap-bottom-small {
            &::after {
              background-color: var(${this.themeVarService.default.border.colorPrimary}) !important;
            }
          }
          
          /* AI总结：隐藏除第一个以外的所有元素 */
          &[tpl=new_baikan_index]:not(:first-of-type) {
            display: none !important;
          }
          /* AI相关：隐藏空内容 */
          &[tpl=ai_ask]:has(> [sub-show="true"]) {
            display: none !important;
          }

          /* AI 智能体 */
          &[tpl="ai_agent_qa_recommend"] {
            .cosd-markdown-content {
              .marklang {
                .marklang-paragraph {
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
            
            [class^="swiper-placehoder-wrapper"] {
              [class*="_ai-input-wrap"] {
                background: transparent !important;

                [class^="_ai-input-send-text"] {
                  white-space: nowrap !important;
                  width: auto !important;
                  background: transparent !important;
                }
              }
            }
          }
          
          /* 惠生活 */
          &[tpl^="jy_bdb_in_store_service"] {
            [class*="goods-title"] {
              color: var(${this.themeVarService.search.default.text}) !important;
            }
          }
          
          /* 高校排行 */
          &[tpl="jy_gk_new_ranking_san"] {
            [class^="list-content"] {
              .cos-divider {
                background-color: transparent !important;
              }
              
              [class^="left"] {
                [class^="text-box"] { 
                  [class^="name-box"] {
                    > [class*="name"] {
                      color: var(${this.themeVarService.search.default.text}) !important;
                    }
                  }
                }
              }
            }
          }
          
          /* 大家还在搜/为你推荐/相关问题 */
          &[tpl="recommend_list"] [class^="list"], .recommend-line, .cosd-question-guide-option {
            a {
              ${this.commonPage.ItemStyles()}
            }
          }
          
          /* 天气 */
          &[tpl="weather_forecast_san"] {
            padding-top: 0 !important;
            padding-bottom: 0 !important;
            
            [class*="aladdin"] {
              margin-top: 0 !important;

              [class*="content-border"] {
                border: none !important;
              }
              
              [class*="_group-title"] {
                color: var(${this.themeVarService.search.default.text}) !important;
              }
              
              a[data-module="living-item"] {
                > [class^="box-item"] {
                  ${this.commonPage.ItemStyles()}
                }
              }
            }
          }
          
          /* 极速下载 */
          &[tpl="pc-soft-accurate"] {
            [class^="pc-tabs-content"] {
              background: transparent !important;
            }
          }
          
          /* 人物/关系 */
          &[tpl="yl_ps_main"] {
            [class*="baike-slink-wrapper"] {
              /* 按钮组 */
              div[class*="button-gap"] {
                padding-bottom: 10px !important;
              }
            }
          }
          &[tpl="yl_ps_relationship"] {
            [class^="title-container"] {
              p[class*="paragraph"] {
                color: var(${this.themeVarService.search.default.text}) !important;
              }
            }
          }
          
          &[tpl="se_com_default"] {
            .c-abstract {
              color: var(${this.themeVarService.search.default.text}) !important;
            }
          }
          
          /* 百度教育汉语 */
          &[tpl="jy_hy_zi_accu_san"] {
            [class^="_content-border"] {
              padding-top: 0 !important;
              padding-bottom: 0 !important;
            }

            [class*="label-title"] {
              span {
                color: var(${this.themeVarService.link.default.text}) !important;
              }
            }
            
            [class^="_horizontal-gradient"], [class^="_vertical-gradient"], [class^="_radial-gradient-left"], [class^="_radial-gradient-right"] {
              background-image: none !important;
            }

            [class^="pinyin-box"] {
              [class^="define-wraper"] {
                span {
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
          }
          
          /* 股票行情 */
          &[tpl="jr_stock_pc"] {
            [class^="stockStateContainer"] {
              [class^="secondLine"] {
                span {
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
          
            [class*="pkInfo"] {
              [class*="pkItem"] {
                div {
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
          }
          
          /* 股票评论 */
          &[tpl="jr_stock_comment_san"] {
            [class^="pc-sub-title"] {
              color: var(${this.themeVarService.search.default.text}) !important;
            }
            
            [class^="comment-wrapper"] {
              span {
                color: var(${this.themeVarService.search.default.textBase}) !important;
                
                
                &.cu-color-source {
                  color: var(${this.themeVarService.link.default.text}) !important;
                }
              }
              
              [class*="time"] {
                > span {
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
          }
          
          &[tpl="generaltable"] {
            /* 标题 */
            h3 {
              color: var(${this.themeVarService.search.default.text}) !important;
              
              a {
                color: var(${this.themeVarService.link.default.text}) !important;
                text-decoration: none !important;
                
                &:hover {
                  color: var(${this.themeVarService.link.default.textHover}) !important;
                  text-decoration: none !important;
                }
                
                em {
                  text-decoration: none !important;
                }
              }
            }
            
            /* 内容 */
            .c-border {
              box-shadow: none !important;
              -webkit-box-shadow: none !important;
              border-color: var(${this.themeVarService.default.border.colorNeutral}) !important;
              
              table {
                th, td {
                  border-color: var(${this.themeVarService.default.border.colorNeutral}) !important;
                }
              }
            }
          }
          
          /* 标题（类型一）*/
          .cosc-title {
            color: var(${this.themeVarService.search.default.textPrimary}) !important;
          }
          
          /* 标题（类型二） */
          [class^="title-wrapper"] {
            [class*="title-box"] {
              display: flex;
              align-items: center;
              justify-content: space-between;
              width: 100%;
            }
          }
          
          /* 标题（类型三） */
          h3[class*="_sc-title"], h3.cosc-title, h3.c-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
          }
          
          /* 标签页 */
          .cos-tabs-header-container {
            .cos-tabs-header {
              margin-right: 40px !important;
              
              .cos-tab {
                color: var(${this.themeVarService.search.default.textBase}) !important;
                
                &.cos-tab-active {
                  color: var(${this.themeVarService.link.default.text}) !important;
                }
              }
            }

            .cos-tabs-right-arrow {
              margin-right: 10px !important;
            }
          }
          
          h3 {
            /* 去掉标题下划线 */
            .cu-line-clamp-default, .cosc-title-slot {
              text-decoration: none !important;
              
              em {
                text-decoration: none !important;
              }
            }
            
            a em {
              text-decoration: none !important;
            }
          }
          
          /* 多行视频内容 */
          .c-row:has(> .c-span3) {
            .c-span3 {
              .c-img {
                background: transparent !important;
              }
            }
          }
          
          /* 描述内容 */
          .c-color-text, .cos-color-text, [class*="summary-text"], .cu-color-text, .cos-text-body, .cos-color-text-tiny  {
            color: var(${this.themeVarService.search.default.text}) !important;
          }
          
          /* 来源描述 */
          .cosc-source-text {
            color: #626675 !important;
          }
          
          /* 备注内容 */
          ._text_pbmk1_40, ._text1_pbmk1_41, ._text2_pbmk1_42 {
            color: #626675 !important;
          }
          
          /* 电话 */
          [class^="phone-wrap"] {
            width: auto !important;
          }
          
          /* 链接 */
          a {
            ${this.stylesService.link.default()}
          }
          
          /* 卡片 */
          .cosc-card-content-border {
            &::after {
              border: none !important;
            }
            
            /* 网络 */
            [class^="dict-content-wrap"] {
              [class^="dict-content"] {
                [class^="mean-text"] {
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
            
            /* 例句 */
            [class^="fy-dictwisenew-liju-cont"] {
              color: var(${this.themeVarService.search.default.text}) !important;
            }
            
            /* 精彩视频 */
            [class^="video-wrap"] {
              [class^="title"] {
                color: var(${this.themeVarService.search.default.text}) !important;
              }
            }
          }
          
          /* 百度保障 */
          .cosc-card-footer {
            .cos-tag {
              margin-left: 0 !important;
              margin-top: 5px !important;
            }
          }
          
          /* 航班 */
          .op-map_flight-main {
            .op-map_flight-tabs-nav {
              background-color: transparent !important;
            }
            
            .op-map_flight-tab_main {
              .op-map_flight-tab_pos_start, .op-map_flight-tab_pos_end, .op-map_flight-tab_input1 {
                background: transparent !important;
                
                input.op-map_flight-tab_text, input.op-map_flight-tab_time1 {
                  color: var(${this.themeVarService.search.default.text}) !important;
                  background: transparent !important;
                }
              }
            }
          }
          
          /* 自驾 */
          [class^="map-self-drive-content-bottom-clamp"] {
            [class^="drive-content"] {
              color: var(${this.themeVarService.search.default.text}) !important;
            }
          }
          
          /* 攻略（类型一） */
          [class*="rank-box"] {
            [class^="right-content"] {
              [class^="right-content-top"] {
                [class^="title-box"] { 
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
          }
          /* 攻略（类型二） */
          [class*="info-box"] {
            [class^="right-content"] {
              [class^="full-box"] {
                [class^="title-box"] { 
                  color: var(${this.themeVarService.search.default.text}) !important;
                }
              }
            }
          }
          
          /* 查看更多（类型一） */
          .cos-more-link-container {
            border: none !important;
            
            &:hover {
              background-color: transparent !important;
              
              .cos-more-link-text {
                color: var(${this.themeVarService.link.default.textHover}) !important;
              }
            }

            .cos-more-link-text {
              color: var(${this.themeVarService.link.default.text}) !important;
            }
          }
          
          /* 查看更多（类型二） */
          [class^="blog-more-wrap"] {
            &:hover {
              background: transparent !important;
              
              [class*="blog-more-span"] {
                color: var(${this.themeVarService.link.default.textHover}) !important;
              }
            }

            [class^="blog-more-line"] {
              background-color: transparent !important;
            }
            [class*="blog-more-span"] {
              color: var(${this.themeVarService.search.default.textPrimary}) !important;
              background-color: transparent !important;
            }
          }
        }
      }

      /* 相关搜索*/
      #rs_new {
        ${BASE_STYLES}
        padding: 6px 0 30px 0 !important;
        
        table {
          tr{
            td {
              a {
                background-color: transparent !important;
                color: var(${this.themeVarService.search.default.text}) !important;
                
                &:hover {
                  color: var(${this.themeVarService.link.default.text}) !important;
                }
              }
            }
          }
        }
      }
    }
    
    /* 分页*/
    #page {
      background: transparent !important;

      > div {
        ${BASE_STYLES}
        padding: 14px 0 !important;
      }
      
      /* 当前页 */
      strong {
        background-color: var(${this.themeVarService.pageBar.currentPage.bg}) !important;
        color: var(${this.themeVarService.pageBar.currentPage.text}) !important;
        border-radius: ${this.themeVarService.pageBar.default.borderRadius} !important;
      }
      
      /* 其他页 */
      a {
        background-color: var(${this.themeVarService.pageBar.otherPage.bg}) !important;
        border-radius: ${this.themeVarService.pageBar.default.borderRadius} !important;
        
        span {
          background-color: var(${this.themeVarService.pageBar.otherPage.bg}) !important;
          color: var(${this.themeVarService.pageBar.otherPage.text}) !important;
        }
        
        &:hover {
          background-color: var(${this.themeVarService.pageBar.otherPage.bgHover}) !important;
          
          span {
            background-color: var(${this.themeVarService.pageBar.otherPage.bgHover}) !important;
            color: var(${this.themeVarService.pageBar.otherPage.textHover}) !important;
          }
        }
      }
    }
  }
  
  /* 无搜索结果 */
  #container > .content_none {
    p, ul li {
      color: var(${this.themeVarService.search.default.text}) !important;
    }
    
    p {
      &.${AppStyleCollections.Search.class.SEARCH_TIP} {
        color: var(${this.themeVarService.message.warning.textPrimary}) !important;
      }

      &.${AppStyleCollections.Search.class.SEARCH_NO_RESULT_TIP} {
        color: var(${this.themeVarService.message.danger.textPrimary}) !important;
      }
    }
  }
  
  /* 页脚 */
  #foot {
    border: none !important;
    background: transparent !important;

    .foot-inner {
      ${BASE_STYLES}
      background: transparent !important;
      
      #help {
        background: transparent !important;
        padding: 0 !important;
        
        a {
          color: var(${this.themeVarService.link.default.text}) !important;
          
          &:hover {
            color: var(${this.themeVarService.link.default.textHover}) !important;
          }
        }
      }
    }
  }

  /* 加载搜索结果的遮罩 */   
  #${this.maskId} {
    background: transparent !important;
    opacity: 0 !important;
    z-index: -10 !important;
  }
`
  }
}
